package com.nisco.dms.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.NotBlank;

@Entity
@Table(name = "Do_Company")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region = "com.nisco.dms.entity")
public class Company {
	@Id
	@GenericGenerator(name = "idGenerator", strategy = "uuid")
	@GeneratedValue(generator = "idGenerator")
	protected String id; // 主键，采取uuid生成策略

	@NotBlank
	@Column(length = 20)
	private String strSn;

	@NotBlank
	@Column(length = 100, nullable = false)
	private String strName;

	@Column(length = 200)
	private String strDesc;

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "createUserId")
	protected User createUser; // 创建者

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "updateUserId")
	protected User updateUser; // 修改日期

	@Column()
	protected String createDateTime; // 创建日期

	@Column()
	protected String updateDateTime; // 修改日期

	@Column()
	private Integer intIsDelete; // 是否为删除，初始为0

	@Column()
	private Integer intIsActive; // 是否为激活，初始位1

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}


	public String getStrSn()
	{
		return strSn;
	}

	public void setStrSn(String strSn)
	{
		this.strSn = strSn;
	}

	public String getStrName() {
		return strName;
	}

	public void setStrName(String strName) {
		this.strName = strName;
	}

	public String getStrDesc() {
		return strDesc;
	}

	public void setStrDesc(String strDesc) {
		this.strDesc = strDesc;
	}

	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	public User getUpdateUser() {
		return updateUser;
	}

	public void setUpdateUser(User updateUser) {
		this.updateUser = updateUser;
	}

	public String getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(String createDateTime) {
		this.createDateTime = createDateTime;
	}

	public String getUpdateDateTime() {
		return updateDateTime;
	}

	public void setUpdateDateTime(String updateDateTime) {
		this.updateDateTime = updateDateTime;
	}

	public Integer getIntIsDelete() {
		return intIsDelete;
	}

	public void setIntIsDelete(Integer intIsDelete) {
		this.intIsDelete = intIsDelete;
	}

	public Integer getIntIsActive() {
		return intIsActive;
	}

	public void setIntIsActive(Integer intIsActive) {
		this.intIsActive = intIsActive;
	}

	/**
	 * reflectionToString将对象输出为string类型。
	 */
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

}
